package cn.edu.hunau.java.week02.day03;

import java.util.Arrays;

public class Player {
    private String name;
    private Card[] cards;

    public Player(String name) {
        this.name = name;
        cards=new Card[0];
    }

    @Override
    public String toString() {
        return "Player{" +
                "name='" + name + '\'' +
                ", cards=" + Arrays.toString(cards) +
                '}';
    }

    public void addCard(Card card) {
        this.cards=Arrays.copyOf(cards,cards.length+1);
        this.cards[cards.length-1]=card;
    }

    public String getName() {
        return name;
    }

    public Card[] getCards() {
        return cards;
    }
}
